using System;
using System.Collections.Generic;
using System.Text;

using SlimDX;
using SlimDX.Direct3D9;

namespace miciv.Rendering
{
    public class RenderableBase : IRenderable
    {
        protected CoreContext m_coreContext;
        protected IRenderer m_renderer;
        protected Matrix m_matWorld;
        protected List<IRendererContext> m_lstRestrictedRendererContexts;
        protected List<IVertexFeeder> m_vertexFeeders;

        public RenderableBase(CoreContext _coreContext)
        {
            this.m_coreContext = _coreContext;
            this.m_matWorld = Matrix.Identity;
            this.m_vertexFeeders = new List<IVertexFeeder>();
        }

        #region IRenderable Members

        virtual public IRenderer Renderer
        {
            get
            {
                return this.m_renderer;
            }
        }

        virtual public SlimDX.Matrix World
        {
            get
            {
                return this.m_matWorld;
            }
        }

        virtual public List<IRendererContext> RestrictedRendererContexts
        {
            get
            {
                return this.m_lstRestrictedRendererContexts;
            }
            set
            {
                this.m_lstRestrictedRendererContexts = value;
            }
        }

        virtual public void UpdateData(float _deltaTime)
        {

        }

        virtual public T[] GetRawVertexBuffer<T>(out int _sCount, out PrimitiveType _primType)
        {
            _sCount = 0;
            _primType = PrimitiveType.PointList;
            return null;
        }

        virtual public ManagedVertexBuffer<T> GetVertexBuffer<T>(out int _sCount, out PrimitiveType _primType) where T : struct
        {
            _sCount = 0;
            _primType = PrimitiveType.PointList;
            return null;
        }

        virtual public List<IVertexFeeder> VertexFeeders
        { 
            get
            {
                return this.m_vertexFeeders;
            }
            set
            {
                this.m_vertexFeeders = value;
            }
        }

        #endregion
    }
}
